#@adminLayout()
#define main()
<div class="card">
    <div class="card-header">
        <h2 class="card-title text-info">区域配置设备信息</h2>
        <div class="progress">
            <div class="progress-bar bg-success" role="progressbar" style="width: 100%" aria-valuenow="100"
                 aria-valuemin="0"
                 aria-valuemax="100"></div>
        </div>
    </div>
    <div class="card-block">
        <div class="row">
            <div class="col-sm-6 text-danger" >
                <div class="card-title">未配置的所有设备信息</div>
                <table class="table table-sm mb-0">
                    <thead>
                    <tr>
                        <th>编号</th>
                        <th>名称</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    #for(x:equipmentList)
                    <tr>
                        <td>#(x.code)</td>
                        <td>#(x.name)</td>
                        <td>
                            <div class="form-group card-title">
                                <div class="toggle-switch toggle-switch--green">
                                    <input type="checkbox" class="toggle-switch__checkbox" onclick="zoneConfigurationDevice('#(rId)','#(x.id)',0)">
                                    <i class="toggle-switch__helper"></i>
                                </div>
                            </div>
                        </td>
                    </tr>
                    #end
                    </tbody>
                </table>
            </div>
            <div class="col-sm-6 text-success" >
                <div class="card-title">当前区域已配置的设备</div>
                <table class="table table-sm mb-0">
                    <thead>
                    <tr>
                        <th>编号</th>
                        <th>名称</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    #for(x:checkedEquimentList)
                    <tr>
                        <td>#(x.code)</td>
                        <td>#(x.name)</td>
                        <td>
                            <div class="form-group card-title">
                                <div class="toggle-switch toggle-switch--green">
                                    <input type="checkbox" class="toggle-switch__checkbox" onclick="zoneConfigurationDevice('#(rId)','#(x.eId)',1)" checked>
                                    <i class="toggle-switch__helper"></i>
                                </div>
                            </div>
                        </td>
                    </tr>
                    #end
                    </tbody>
                </table>
            </div>
        </div>

    </div>
</div>
#end
<script>
    function zoneConfigurationDevice(a,b,c) {
        console.info(c);
        $.post("/admin/ciis/region/zoneConfigurationDevice",{rid:a,eid:b,type:c},function (ret) {
            if (ret.state=='ok'){
                console.info(ret.state);
                showMsg(0,ret.msg);
                kpjax("/admin/ciis/region/config?id="+a)
            }else{
                showMsg(3,ret.msg);
            }
        })
    }
</script>
